package com.aspose.cells;

import java.util.Iterator;

class zaau {
   Worksheet a;
   zyi[] b;
   int c;
   zakl d;
   zyq e;

   zaau(Worksheet var1) {
      this.a = var1;
      this.b = new zyi[16];
      this.d = new zakl();
   }

   zyi a(int var1) {
      return this.b[var1];
   }

   void a(int var1, zyi var2) {
      if (this.b[var1] != var2) {
         if (this.e != null) {
            this.e.a(this.b[var1]);
         }

         var2.a = var1;
         this.b[var1] = var2;
      }

   }

   void a() {
      this.b = new zyi[16];
      this.d = new zakl();
      this.e = null;
      Worksheet var2;
      if (this.a.getWorkbook().a) {
         for(Iterator var1 = this.a.c().iterator(); var1.hasNext(); var2.getCells().b.e = null) {
            var2 = (Worksheet)var1.next();
         }
      }

   }

   int a(zyi var1) {
      if (this.d.a() == 0) {
         this.c(1);
         var1.a = this.c;
         this.b[this.c] = var1;
      } else {
         int var2 = this.d.b();
         this.b[var2] = var1;
         var1.a = var2;
      }

      ++this.c;
      return var1.a;
   }

   void b(int var1) {
      if (this.e != null) {
         this.e.a(this.b[var1]);
      }

      this.b[var1] = null;
      --this.c;
      this.d.a(var1);
   }

   void c(int var1) {
      int var2 = this.c + var1;
      if (var2 > this.b.length) {
         int var3 = this.b.length * 2;
         if (var3 < var2) {
            var3 = var2;
         }

         zyi[] var4 = new zyi[var3];
         System.arraycopy(this.b, 0, var4, 0, this.b.length);
         this.b = var4;
      }

   }
}
